<?php

require_once dirname(__FILE__).'/model/common.inc.php';
require_once dirname(__FILE__).'/model/yuyuetype.inc.php';

//预约提交
if($action == "tel")
{
	require_once('amfcms/model/extends/checktime.php');
	checktime('tel');
	$handetime=time();
	$telephone = RemoveXSS($telephone);
	if(!preg_match('/^1[3458][0-9]{9}$/',$telephone)){
		//验证不通过
		myShowMsg('请输入正确的手机号码','-1');
		exit();
	}
	$query="insert into `#@__yy_order` (`name`,`telephone`,`keshi`,`type`,`handtime`,`orderid`)values ('手机号','$telephone','网上电话','预约','$handetime','000000'); ";//2014-02-22
	if($dsql->ExecuteNoneQuery($query))
	{
		$mailtitle =$telephone."请求通话";
		$mailbody .= "您好！ 手机";
		$mailbody .=$telephone."：  请求通话-网上预约";
		$mailtitle=iconv("utf-8","gb2312",$mailtitle);
		$mailbody =iconv("utf-8","gb2312",$mailbody);
		//发送邮件

		isend($mailbody);
		mail(get_kefu_email(),$mailtitle,$mailbody,$headers ="From:".iconv("utf-8","gb2312","预约")."<".get_email_admin().">\r\n");
		echo "<script>alert('".$GLOBALS['cfg_webname']."提醒您：正在为你接通您热线，请稍候！本次通话免费! ');";
		echo "	window.location.replace('".$GLOBALS['cfg_swt']."');\r\n";
		echo "</script>";
		exit();
	}
	else
	{
		myShowMsg($telephone.'系统在维护，请稍候再试','-1');
		exit();
	}

}



//加载模板
$dtp = new DedeTemplate();
$dtp->LoadTemplate(YUYUEROOT.'/template/default/tel.htm');
$dtp->Display();

?>